from tortoise import BaseDBAsyncClient


async def upgrade(db: BaseDBAsyncClient) -> str:
    return """
        ALTER TABLE "tb_system_visitors" ALTER COLUMN "ip" DROP NOT NULL;
        ALTER TABLE "tb_system_visitors" ALTER COLUMN "country" DROP NOT NULL;
        ALTER TABLE "tb_system_visitors" ALTER COLUMN "region" DROP NOT NULL;
        ALTER TABLE "tb_system_visitors" ALTER COLUMN "city" DROP NOT NULL;"""


async def downgrade(db: BaseDBAsyncClient) -> str:
    return """
        ALTER TABLE "tb_system_visitors" ALTER COLUMN "ip" SET NOT NULL;
        ALTER TABLE "tb_system_visitors" ALTER COLUMN "country" SET NOT NULL;
        ALTER TABLE "tb_system_visitors" ALTER COLUMN "region" SET NOT NULL;
        ALTER TABLE "tb_system_visitors" ALTER COLUMN "city" SET NOT NULL;"""
